﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace FirstFloor.Documents.Pdf
{
    /// <summary>
    /// Encapsulates the data of a single glyph index point.
    /// </summary>
    internal struct GlyphIndexPoint
    {
        /// <summary>
        /// Gets the glyph index.
        /// </summary>
        /// <value>The index.</value>
        public ushort? GlyphIndex { get; internal set; }
        /// <summary>
        /// Gets the glyph width measured in units in which 1000 units corresponds to 1 unit in text space.
        /// </summary>
        /// <value>The width.</value>
        public double Width { get; internal set; }
        /// <summary>
        /// Gets the unicode code point.
        /// </summary>
        /// <value>The unicode code point.</value>
        public char? UnicodeCodePoint { get; internal set; }
        /// <summary>
        /// Gets a value indicating whether this instance represents the space character.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance represents the space character; otherwise, <c>false</c>.
        /// </value>
        public bool IsSpaceCharacter { get; internal set; }

        /// <summary>
        /// Advances the glyph width and returns a new instance of a glyph index point.
        /// </summary>
        /// <param name="advance">The advance.</param>
        /// <returns></returns>
        public GlyphIndexPoint Advance(double advance)
        {
            return new GlyphIndexPoint() {
                GlyphIndex = this.GlyphIndex,
                Width = this.Width + advance,
                UnicodeCodePoint = this.UnicodeCodePoint,
                IsSpaceCharacter = this.IsSpaceCharacter
            };
        }
    }
}
